<!--微站资源录入-->
<template>
  <t-collapse v-if="isMicrostation" title="微站资源录入">
    <el-tabs value="first">
      <el-tab-pane label="采购清单" name="first">
        <div>
          投资总计(元)
          <el-input
            placeholder="请输入内容"
            :value="totalInvest"
            style="width: 200px"
            size="mini"
            disabled
          />
        </div>
        <el-table
          :data="tableData"
          border
          style="width: 100%;margin-top: 10px"
        >
          <el-table-column align="center" type="index" label="序号" width="50" fixed />
          <el-table-column
            v-for="item in tableColumns"
            :key="item.prop"
            :prop="item.prop"
            :label="item.label"
          />
        </el-table>
      </el-tab-pane>
    </el-tabs>
    <pagination
      :is-popper-body="false"
      :total="total"
      :page.sync="params.pageNum"
      :limit.sync="params.pageSize"
      @pagination="getTable"
    />
  </t-collapse>
</template>
<script>

import {getPurchaseServiceListApi} from "@/api/acceptance";

export default {
  name: 'Schedule',
  inject: ['prjDetail'],
  props: ['prjId'],
  computed: {
    isMicrostation() {
      return this.newPrjDetail.prjType === 'G'
    },
    newPrjDetail() {
      return this.prjDetail()
    },
  },
  data() {
    return {
      tableColumns: [
        {
          prop: 'epcCategoryCode',
          label: '服务编码'
        },
        {
          prop: 'epcCategoryName',
          label: '服务名称'
        },
        {
          prop: 'amount',
          label: '数量'
        },
        {
          prop: 'unit',
          label: '单位'
        },
        {
          prop: 'price',
          label: '单价'
        },
        {
          prop: 'equipSum',
          label: '合价'
        },
        {
          prop: 'remark',
          label: '备注'
        }
      ],
      params: {
        prjId: this.prjId,
        pageNum: 1,
        pageSize: 10
      },
      total: 0,
      totalInvest: '',
      tableData: []
    }
  },

  created() {
    this.getTable()
  },
  methods: {
    async getTable() {
      const result = await getPurchaseServiceListApi(this.params)
      this.totalInvest = result.data.totalInvest
      this.total = result.data.tableDataInfo.total
      this.tableData = result.data.tableDataInfo.rows
    }
  }
}
</script>

<style scoped lang='scss'>
</style>
